<template>
	<view class="classlist">
		<view class="content">
			<navigator url="/pages/preview/preview" class="item" v-for="item in 10">
				<image src="../../static/cute.jpg" mode="aspectFill"></image>
			</navigator>
			
			<navigator url="/pages/preview/preview" class="item" v-for="item in classList" :key="item._id">
				<image :src="item.smallPicurl" mode="aspectFill"></image>
			</navigator>
		</view>
	</view>
</template>

<script setup>
	import { ref } from 'vue';
	import { onLoad } from "@dcloudio/uni-app"
	import { api_getClassList } from "@/api/apis.js"
	const classList = ref([]);
	
	const queryParams = {};
	
	onLoad( (e)=>{
		console.log(e);
		let { id=null } = e;
		queryParams.classid = id
		console.log(id);
		uni.setNavigationBarTitle({
			title: name
		});
		
		getClassList();
	} )
	
	//跳转到这个页面的时候接受classid参数
	
	const getClassList = async ()=>{
		// let res = await api_GetClassList({
		// 	classid:"todo"
		// });
		let res = await api_getClassList(queryParams);
		console.log(res);
	
		classList.value = res.data;
	}
</script>

<style lang="scss" scoped>
	.classlist{
		.content{
			display: grid;
			grid-template-columns: 1fr 1fr 1fr;
			gap: 5rpx;
			padding: 5rpx;
			.item{
				height: 444rpx;
				image{
					width: 100%;
					height: 100%;
					display: block;
					
				}
			}
		}
	}

</style>
